package com.sunny.springboot2.core.exception;

import com.sunny.springboot2.enums.ExceptionEnums;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 自定义异常
 * @author sunny
 * @date 2018/11/27
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CustomException extends Exception {

    private int code;
    private String msg;

    public CustomException(ExceptionEnums enums) {
        this.code = enums.getErrorCode();
        this.msg = enums.getErrorMessage();
    }
}
